package com.project.mall.service;

import com.project.mall.mapper.MapperC;
import com.project.mall.pojo.Address;
import com.project.mall.pojo.Orders;
import com.project.mall.pojo.Orderstate;
import com.project.mall.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ServiceImplC implements ServiceC {
    @Resource
    private MapperC mapper;


    @Override
    public User login(String phone) {
        return mapper.login(phone);
    }

    @Override
    public boolean addNewUser(User user) {
        return mapper.addNewUser(user)>0?true:false;
    }

    @Override
    public int register(String phone) {
        return mapper.register(phone);
    }

    @Override
    public User getAllbyphone(String phone) {
        return mapper.getAllbyphone(phone);
    }

    @Override
    public int getIdByPhone(String phone) {
        return mapper.getIdByPhone(phone);
    }

    @Override
    public boolean updateUser(User user) {
        return mapper.updateUser(user)>0?true:false;
    }

    @Override
    public boolean updatepwd(User user) {
        return mapper.updatepwd(user)>0?true:false;
    }

    @Override
    public List<Address> getAdressByuser(int userid) {
        return mapper.getAdressByuser(userid);
    }

    @Override
    public boolean addAddress(Address address) {
        return mapper.addAddress(address)>0?true:false;
    }

    @Override
    public boolean updateAddress(Address address) {
        return mapper.updateAddress(address)>0?true:false;
    }

    @Override
    public Address getaddressAllByAddID(int addid) {
        return mapper.getaddressAllByAddID(addid);
    }

    @Override
    public List<Orders> getSelfrderby(int userid) {
        return mapper.getSelfrderby(userid);
    }

    @Override
    public List<Orderstate> getOrderstatebyuserid(int userid) {
        return mapper.getOrderstatebyuserid(userid);
    }

    @Override
    public int addorders(Orders orders) {
        return mapper.addorders(orders);
    }


}
